<include file="Public/header" />
<include file="Public/menu" />
<!-- 内容页 -->
<div class="content-wrapper">
    <!-- 面包屑 -->
    <section class="content-header">
        <h1>
            店铺配置
            <small>管理</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 店铺配置</a></li>
            <li class="active">新增快递运费模板</li>
        </ol>
    </section>

    <!-- 内容 -->
    <section class="content"><div class="row"><div class="col-md-12">
        <div class="box box-info">
            <div class="box-header with-border">
                <h3 class="box-title">新增快递运费模板</h3>

                <div class="box-tools">

                    <div class="btn-group pull-right" style="margin-right: 10px">
                        <a href="/Qgs/freight/dlytmp" class="btn btn-sm btn-default"><i class="fa fa-list"></i>&nbsp;快递运费模板列表</a>
                    </div>
                </div>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form action="" method="post" accept-charset="UTF-8" class="form-horizontal" id="form">
                <div class="box-body">
                    <div class="form-group">
                        <label class="col-sm-2 control-label" for="InputVendorName">运费模板名称</label>
                        <div class="col-sm-6">
                            <div class="no-margin">
                                <input name="type_name" value="{$info.type_name}" type="text"
                                       class="form-control" id="InputVendorName" placeholder="运费模板名称">
                            </div>
                        </div>
                    </div>
                    <h1 style="margin-left: 200px">默认运费模板</h1>
                    <div class="form-group 1">
                        <label class="col-sm-2 control-label">首重</label>
                        <div class="col-sm-6">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                                <input type="test" name="firstunit" value="" class="form-control" placeholder="首重">
                                <span class="input-group-addon">Kg</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group 1">
                        <label class="col-sm-2 control-label">首重运费</label>
                        <div class="col-sm-6">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                                <input type="test" name="firstprice" value="" class="form-control" placeholder="首重运费">
                                <span class="input-group-addon">元</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group 1">
                        <label class="col-sm-2 control-label">续重</label>
                        <div class="col-sm-6">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                                <input type="test" name="continueunit" value="" class="form-control" placeholder="续重">
                                <span class="input-group-addon">Kg</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group 1">
                        <label class="col-sm-2 control-label">续重费</label>
                        <div class="col-sm-6">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                                <input type="test" name="continueprice" value="" class="form-control" placeholder="首重运费">
                                <span class="input-group-addon">元</span>
                            </div>
                        </div>
                    </div>

                    <div class="form-group hide">
                        <label class="col-sm-2 control-label">添加区域设置</label>
                        <div class="col-sm-6">
                            <div class="no-margin">
                                <button type="button" class="btn btn-default pull-left" id="daterange-btn">
                                            <span>
                                              <i class="fa fa-calendar"></i> 点击添加区域设置
                                            </span>
                                    <i class="fa fa-caret-down"></i>
                                </button>
                            </div>
                        </div>
                    </div>
                    <div class="form-group hide">
                        <div class="col-sm-offset-2 col-sm-6 <?php if(count($list) <= 0) echo '';?>">
                            <div class="box box-primary">
                                <!-- /.box-header -->
                                <div class="box-body">
                                    <ul class="todo-list ui-sortable">
                                        <volist name="list" id="vo">
                                            <li class="">
                                                <input type="hidden" name="store_pid[]" value="{$vo.store_pid}">
                                                <span class="handle ui-sortable-handle">
                                                    <i class="fa fa-ellipsis-v"></i>
                                                    <i class="fa fa-ellipsis-v"></i>
                                                  </span>
                                                <span class="text">{$vo.name}</span>
                                                <small class="label label-warning"> 售价 : {$vo.price}</small>
                                                <small class="label label-success"> 库存 : {$vo.store}</small>
                                                <div class="tools">
                                                    <i class="fa fa-trash-o icondel"></i>
                                                </div>
                                            </li>
                                        </volist>
                                    </ul>
                                </div>
                                <!-- /.box-body -->
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /.box-body -->
                <div class="box-footer">
                    <div class="col-sm-2">

                    </div>
                    <div class="col-sm-6">

                        <div class="btn-group pull-right">
                            <button type="submit" class="btn btn-info pull-right">提交</button>
                        </div>

                    </div>

                </div>
                <!-- /.box-footer -->
            </form>
        </div>

    </div></div>

    </section>
</div>


<!-- 底部 -->
<include file="Public/common_footer" />
<script src="/Public/layer/layer.js"></script>
<script src="Public/admin/adminlte/dist/js/pages/dashboard3.js"></script>
<script data-exec-on-popstate>
    $('#daterange-btn').click(function () {
        layer.open({
            type: 2,
            title: '店铺商品库',
            area: ['700px', '530px'],
            fixed: false,
            maxmin: true,
            content: "{:U('freight/dlytmpAreaAdd',array('type_id'=>''))}"
        });

    });

    $(".ui-sortable").on("click",".icondel", function() {
        $(this).parent().parent().remove();
    });

    $(".ui-sortable").on("click",".add_area", function() {
        layer.open({
            type: 2,
            title: '店铺商品库',
            area: ['1200px', '800px'],
            fixed: false,
            maxmin: true,
            content: "{:U('freight/dlytmpAddress',array('type_id'=>''))}"
        });
    });

    //表单验证
    $("#form").validate({
        rules: {
            type_name:{
                required: true,
				rangelength: [2, 50]
            },
            firstunit:{
                required: true,
				isPrice: true,
				min:0.01
            },
            firstprice:{
                required: true,
				isPrice: true,
				min:0.01
            },
            continueunit:{
                required: true,
				isPrice: true,
				min:0.01
            },
            continueprice:{
                required: true,
				isPrice: true,
				min:0.01
            }
        },
        messages:{
            type_name: {
                required: "请输入运费模板名称"
            },
            firstunit: {
                required: "请输入首重"
            },
            firstprice: {
                required: "请输入首重运费"
            },
            continueunit: {
                required: "请输入续重"
            },
            continueprice: {
                required: "请输入续重费"
            }
        },
        submitHandler: function(form){
            form.submit();   //提交表单
        }
    });

</script>

